package org.schoolnavigator.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionFactory {
	private static ConnectionFactory connectionFactory = new ConnectionFactory();
	private String url = "jdbc:mysql://localhost:3306/pagedb";
	private String password = "root";
	private String user = "root";
	private String driverClass = "com.mysql.jdbc.Driver";
	
	private ConnectionFactory(){
		try{
			Class.forName(driverClass);
		}catch(ClassNotFoundException e){
			e.printStackTrace();
		}
	}
	
	public static ConnectionFactory getInstance(){
		return connectionFactory;
	}
	
	public Connection getConnection() throws SQLException, ClassNotFoundException {
		Connection con = null;
		con = DriverManager.getConnection(url, user, password);
		return con;
	}
	
}
